Search dylib path from cargo before system
authorXidorn Quan <me@upsuper.org>
Mon, 18 Jul 2016 07:25:22 +0000 (17:25 +1000)
committerXidorn Quan <me@upsuper.org>
Mon, 18 Jul 2016 07:25:22 +0000 (17:25 +1000)
Cargo should have more knowledge about what it is looking for, and thus
its paths should be more correct compared to system's. When there are
conflicts, the search paths provided by the build system should take
priority.

src/cargo/ops/cargo_rustc/compilation.rs

index a01af9f595ab6f7796566d3a2aca85051780c8ef..71263450d366fc04972231696679cf18d44ea240 100644 (file)
@@ -93,7 +93,7 @@ impl<'cfg> Compilation<'cfg> {
     /// well as the working directory of the child process.
     pub fn process(&self, cmd: CommandType, pkg: &Package)
                    -> CargoResult<CommandPrototype> {
-        let mut search_path = util::dylib_path();
+        let mut search_path = vec![];
 
         // Add -L arguments, after stripping off prefixes like "native=" or "framework=".
         for dir in self.native_dirs.iter() {
@@ -115,6 +115,7 @@ impl<'cfg> Compilation<'cfg> {
         }
         search_path.push(self.root_output.clone());
         search_path.push(self.deps_output.clone());
+        search_path.extend(util::dylib_path().into_iter());
         let search_path = try!(util::join_paths(&search_path,
                                                 util::dylib_path_envvar()));
         let mut cmd = try!(CommandPrototype::new(cmd, self.config));